require 'test/unit'
require 'lib/smppclient/pdu/tlv/ms_availability_status'
require 'lib/smppclient/util/byte_buffer'

class TestMsAvailabilityStatus < MiniTest::Unit::TestCase

  include SmppClient::Pdu::Tlv
  include SmppClient::Util

  def test_bytes_to_object
    bb = ByteBuffer.new
    bb.append_short(0x0422)
    bb.append_short(0x0001)
    bb.append_byte(10)

    mas = MsAvailabilityStatus.new(bb)
    assert_equal(Tag::MS_AVAILABILITY_STATUS, mas.tag)
    assert_equal(1, mas.length)
    assert_equal(10, mas.value)
    assert_equal('042200010a', mas.buffer.to_s)
  end

  def test_object_to_bytes
    mas = MsAvailabilityStatus.new(2)
    assert_equal('0422000102', mas.buffer.to_s)
    assert_equal(Tag::MS_AVAILABILITY_STATUS, mas.tag)
    assert_equal(1, mas.length)
    assert_equal(2, mas.value)
  end

end